package thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class ThreadTest6 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ThreadTest16 threadTest16 = new ThreadTest16();
        threadTest16.start();

        Thread thread = new Thread(new ThreadTest17(),"Runnable 实现方式");
        thread.start();

        FutureTask<String> futureTask = new FutureTask<String>(new ThreadTest18());
        Thread thread1 = new Thread(futureTask);
        thread1.start();
        System.out.println(futureTask.get()+",callable 实现方式");




    }
}

class ThreadTest16 extends Thread{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"欢迎进入多线程");
    }
}

class ThreadTest17 implements Runnable{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"欢迎进入多线程");

    }
}

class ThreadTest18 implements Callable<String>{

    @Override
    public String call() throws Exception {
        return Thread.currentThread().getName();
    }
}
